package com.mx.tool.form.window;

import com.intellij.openapi.wm.ToolWindow;
import com.mx.tool.form.factory.*;

import javax.swing.*;

/**
 * @Author: 徐建鹏.
 * @create: 2021-11-09 16:30
 * @Description:
 */
public class MxToolWindow {

    //主面板
    private JPanel mxToolJPanel;

    /**
     * 加密解密
     */
    //hash按钮
    private JButton hashButton;
    //加解密按钮
    private JButton encryptionButton;
    //base64按钮
    private JButton base64Button;
    //加密解密面板
    private JPanel encryptionPanel;

    /**
     * 转换
     */
    //json工具按钮
    private JButton jsonToolButton;
    //url编码按钮
    private JButton urlButton;
    //时间戳按钮
    private JButton timeUtcButton;
    //汉字转拼音按钮
    private JButton hzToPyButton;
    //unicode按钮
    private JButton unicodeButton;
    //json转实体类按钮
    private JButton jsonToEntityButton;
    //变量名按钮
    private JButton varNameButton;
    //jwt解码按钮
    private JButton jwtButton;
    //转换面板
    private JPanel zhPanel;

    /**
     * 校验
     */
    //正则
    private JButton zzButton;
    //定时任务
    private JButton cronButton;
    //校验面板
    private JPanel jyPanel;

    /**
     * 二维码
     */
    //生成二维码
    private JButton qrCreateButton;
    //解析二维码
    private JButton qrJxButton;
    //二维码面板
    private JPanel qrPanel;

    /**
     * 其他
     */
    //ip查询
    private JButton ipButton;
    //手机号查询
    private JButton mobileButton;
    //生成
    private JButton createButton;
    //其他面板
    private JPanel otherPanel;
    //网站源码下载
    private JButton webSourceButton;
    /**
     * 常用网址
     */
    //常用
    private JButton commonButton;
    //服务器
    private JButton fwqButton;
    //框架
    private JButton kjButton;
    //前端
    private JButton frontButton;
    //网址面板
    private JPanel websitePanel;


    //笔记面板
    private JPanel bjPanel;
    //反馈面板
    private JPanel fkjPanel;
    //翻译面板
    private JPanel fyjPanel;


    public MxToolWindow(ToolWindow toolWindow) {
        //添加加密解密面板监听
        EncryptionFactory.addActionListeners(hashButton,encryptionButton,base64Button,encryptionPanel);
        //添加转换面板监听
        ZhFactory.addActionListeners(jsonToolButton,urlButton,timeUtcButton,hzToPyButton,unicodeButton,jsonToEntityButton,varNameButton,jwtButton,zhPanel);
        //添加校验面板监听
        JyFactory.addActionListeners(zzButton,cronButton,jyPanel);
        //添加二维码面板监听
        QrFactory.addActionListeners(qrCreateButton,qrJxButton,qrPanel);
        //添加其他面板监听
        OtherFactory.addActionListeners(ipButton,mobileButton,createButton,webSourceButton,otherPanel);
        //添加网址面板监听
        WebsiteFactory.addActionListeners(commonButton,fwqButton,kjButton,frontButton,websitePanel);
        //添加笔记面板
        bjPanel.add("bjJPanel", new BjWindow().getContent());
        //添加反馈面板
        fkjPanel.add("fjJPanel", new FkWindow().getContent());
        //添加翻译面板
        fyjPanel.add("fyJPanel", new FanyiWindow().getContent());

    }


    public JPanel getContent() {
        return mxToolJPanel;
    }


    private void createUIComponents() {
        // TODO: place custom component creation code here
    }
}
